<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for src/components/MMS/Engine/Datasource/Item_Column.vue</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="..\..\..\..\..\prettify.css" />
    <link rel="stylesheet" href="..\..\..\..\..\base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type='text/css'>
        .coverage-summary .sorter {
            background-image: url(..\..\..\..\..\sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class='wrapper'>
  <div class='pad1'>
    <h1>
      <a href="..\..\..\..\..\index.html">All files</a> / <a href="index.html">src/components/MMS/Engine/Datasource</a> Item_Column.vue
    </h1>
    <div class='clearfix'>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Statements</span>
        <span class='fraction'>0/32</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Branches</span>
        <span class='fraction'>0/8</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Functions</span>
        <span class='fraction'>0/17</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Lines</span>
        <span class='fraction'>0/32</span>
      </div>
    </div>
  </div>
  <div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">&lt;template&gt;
  &lt;div o-Container&gt;
    &lt;o-item v-bind:source="item.language" v-bind="{saved:save,backed:back}"&gt;&lt;/o-item&gt;
    &lt;o-item v-bind:source="item.datacolumn" v-bind="{loaded:load}"&gt;&lt;/o-item&gt;
  &lt;/div&gt;
&lt;/template&gt;
&nbsp;
&lt;script&gt;
  export default {
    name: "mms_engine_datacolumn_item", /* 这个name暂时不知道用啥用，根据官方文档说的是方便排错的 */
<span class="fstat-no" title="function not covered" >    data() {</span>
<span class="cstat-no" title="statement not covered" >      return {</span>
        octopus: this.$parent.octopus,
        item: {
          language: {
            data: {
              id: 17,
              value: null,
              cellData: [{name: "CN"},
                {name: "ZH"},
                {name: "EN"},
                {name: "JP"},
                {name: "KR"},
                {name: "CreateDate"}]
            },
            // 自定义button按钮，开发者选项。
            button: [{class: "btn-warning", click: this.translate, text: "Translate"}]
          },
          datacolumn: {
            data: {
              id: 20,
              value: "#{param=id}",
              cellData: [{name: "Name"},
                {name: "ControlTypeID"},
                {name: "ControlSourceID"},
                {name: "ControlSourceText"},
                {name: "ControlSourceValue"},
                {name: "ControlSourceOrder"},
                {name: "ControlSourceParentKey"},
                {name: "ControlSourceParentValue"},
                {name: "IsNull"},
                {name: "IsDisabled"},
                {name: "IsEncryption"},
                {name: "IsHierarchy"},
                {name: "DefaultValue"},
                {name: "TableID", show: false},
                {name: "RasterizeXS"},
                {name: "RasterizeSM"},
                {name: "RasterizeMD"},
                {name: "RasterizeLG"},
                {name: "Height"},
                {name: "Width"},
                {name: "MinLength"},
                {name: "MaxLength"},
                {name: "LanguageID", show: false},
                {name: "Note"},
                {name: "CreateDate"},]
            },
          },
        },
      }
    },
<span class="fstat-no" title="function not covered" >    mounted: function () {</span>
    },
    methods: {
      // 数据源列数据加载完成后的事件
<span class="fstat-no" title="function not covered" >      load: function () {</span>
        // 数据源列编辑页，列肯定是有数据的，这个功能不允许自己创建新列的。
<span class="cstat-no" title="statement not covered" >        if (this.item.datacolumn.data.value) {</span>
          // Menu菜单加载完成后，将值赋值给语言对象
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >          this.item.language.data.value = $.grep(this.item.datacolumn.data.cellData, function (value) {</span></span>
<span class="cstat-no" title="statement not covered" >            return value.name == "LanguageID";//筛选出语言ID编号</span>
          })[0].defaultValue;
          // 这里调用控件对象的方法。
<span class="cstat-no" title="statement not covered" >          this.item.language.control.load();</span>
        }
      },
      // 保存后回调事件，主控件为主的，子控件依赖主控件的，可在主控件保存后调用子控件的save。
      // 回调时因为数据是全部钩子动态绑定的，唯独因为创建会把保存类型给冲掉，所以这样要回传保存的类型
<span class="fstat-no" title="function not covered" >      save: function (data) {</span>
<span class="cstat-no" title="statement not covered" >        if (data.status.code == 200) {</span>
          // 在Menu数据源中找到LanguageID变量并设置
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >          $.grep(this.item.datacolumn.data.cellData, function (value) {</span></span>
<span class="cstat-no" title="statement not covered" >            return value.name == "LanguageID";//筛选出语言ID编号</span>
          })[0].defaultValue = this.item.language.data.value;
          // 执行菜单表的保存，组件内部会自动识别是创建还是更新。
<span class="cstat-no" title="statement not covered" >          this.item.datacolumn.control.save();</span>
<span class="cstat-no" title="statement not covered" >          this.octopus.tips.success("[" + data.status.code + "] Data Save Success.");</span>
        } else {
<span class="cstat-no" title="statement not covered" >          this.octopus.tips.error(data);</span>
        }
      },
<span class="fstat-no" title="function not covered" >      back: function () {</span>
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >        let TableID = $.grep(this.item.datacolumn.data.cellData, function (curr, i) {</span></span>
<span class="cstat-no" title="statement not covered" >          return curr.name == "TableID";</span>
        });
<span class="cstat-no" title="statement not covered" >        if (TableID.length == 1) {</span>
<span class="cstat-no" title="statement not covered" >          this.octopus.router.jump("/MMS/Engine/Datasource/Modify?id=" + TableID[0].defaultValue);</span>
        }
      },
<span class="fstat-no" title="function not covered" >      create: function () {</span>
        // 手动触发注销函数。
        // this.item.datacolumnbind.control.destroyData();
        // this.item.datacolumnbind.control.load();
      },
<span class="fstat-no" title="function not covered" >      translate: function () {</span>
<span class="cstat-no" title="statement not covered" >        let o = this;</span>
<span class="cstat-no" title="statement not covered" >        let CN = flm("CN");</span>
<span class="cstat-no" title="statement not covered" >        let language = ["ZH", "EN", "JP", "KR"];</span>
        // 如果中文有值，才进入。
<span class="cstat-no" title="statement not covered" >        if (!this.octopus.tools.IsNullOrEmpty(CN.defaultValue)) {</span>
          // 翻译为繁体
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >          this.octopus.tools.translate(CN.defaultValue, "zh", "cht", function (cht_data) {</span></span>
<span class="cstat-no" title="statement not covered" >            flm("ZH").defaultValue = cht_data;</span>
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >            o.octopus.tools.translate(CN.defaultValue, "zh", "en", function (en_data) {</span></span>
<span class="cstat-no" title="statement not covered" >              flm("EN").defaultValue = en_data;</span>
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >              o.octopus.tools.translate(CN.defaultValue, "zh", "jp", function (jp_data) {</span></span>
<span class="cstat-no" title="statement not covered" >                flm("JP").defaultValue = jp_data;</span>
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >                o.octopus.tools.translate(CN.defaultValue, "zh", "kor", function (kr_data) {</span></span>
<span class="cstat-no" title="statement not covered" >                  flm("KR").defaultValue = kr_data;</span>
                  // 延迟500毫秒给vue一个反应的时间。
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >                  setTimeout(function () {</span></span>
                    // 执行保存
<span class="cstat-no" title="statement not covered" >                    o.item.language.control.save();</span>
                  }, 500);
                });
              });
            });
          });
        } else {
<span class="cstat-no" title="statement not covered" >          this.octopus.tips.warning("ChineseBox is not null, Translate service failed.")</span>
        }
&nbsp;
        // find language module
<span class="fstat-no" title="function not covered" >        function flm(code) {</span>
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >          return $.grep(o.item.language.data.cellData, function (value) {</span></span>
<span class="cstat-no" title="statement not covered" >            return value.name == code;//筛选出语言ID编号</span>
          })[0]
        }
      },
    },
    props: ["oData"]
  }
&lt;/script&gt;
&nbsp;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
  Code coverage
  generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Jan 20 2020 17:54:15 GMT+0800 (GMT+08:00)
</div>
</div>
<script src="..\..\..\..\..\prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>
<script src="..\..\..\..\..\sorter.js"></script>
</body>
</html>
